package org.hnsd.train.pattern.factory;

/**
 * @author youqd
 * @tag.date 2023-11-01 11:09
 **/
public class EventFactory implements Factory{

    @Override
    public AbstractEvent createEvent(String eventName) {
        if ("dispatch".equals(eventName)) {
            return new DispatchEvent();
        } else if ("back".equals(eventName)) {
            return new BackEvent();
        } else {
        return null;
    }
}

}

interface Factory {
    AbstractEvent createEvent(String eventName);
}
